package com.example.administrator.myapplication4.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.administrator.myapplication4.R;
import com.example.administrator.myapplication4.bean.Weather;

import java.util.List;

/**
 * Created by Administrator on 2020/12/14.
 */

public class Myadapter extends BaseAdapter {
    private Context context;
    private List<Weather.ResultBean.FutureBean> futureBeenList;

    public Myadapter(Context context, List<Weather.ResultBean.FutureBean> futureBeenList) {
        this.futureBeenList = futureBeenList;
        this.context = context;
    }

    //    private  List<Weather.ResultBean.FutureBean> futureBeanList;
//    public Myadapter(Context context,List<Weather.ResultBean.FutureBean> futureBeanList){
//        this.futureBeanList = futureBeanList;
//    }
    @Override
    public int getCount() {
        return futureBeenList.size();
    }

    @Override
    public Object getItem(int i) {
        return futureBeenList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view = view.inflate(context, R.layout.listview_item_activity, null);
        TextView textView1 = view.findViewById(R.id.text1_tv);
        TextView textView2 = view.findViewById(R.id.text2_tv);
        TextView textView3 = view.findViewById(R.id.text3_tv);
        TextView textView4 = view.findViewById(R.id.text4_tv);
        TextView textView5 = view.findViewById(R.id.text5_tv);
        textView1.setText(futureBeenList.get(i).getTemperature() + "");
        textView2.setText(futureBeenList.get(i).getWeather() + "");
        textView3.setText(futureBeenList.get(i).getWind() + "");
        textView4.setText(futureBeenList.get(i).getWeek() + "");
        textView5.setText(futureBeenList.get(i).getDate() + "");


        return view;
    }
}
